<meta charset="<?= getMessageByKey("default.charset") ?>">
<?php
$resultSet = getUsersGallery($id);
?>

<div class="maincommon">

  <?php
  include_once("profile_menu.php");
  ?>
  <div class="profilesectionheader">
    <?= getMessageByKey("user.profile.gallery.header") ?>
  </div>
  <?php
  $resultSet = getUsersGallery($id);

  $resultRow = mysql_fetch_assoc($resultSet);

  if ($resultRow == null) {
    ?>
    <div class="noimages">
      <?= getMessageByKey('user.profile.gallery.noimages')?>
    </div>
  <?php
  } else {

    do {

      ?>

      <div class="gallerydiv">
        <img src="<?= \controller\Config::getPropertyByKey('directory.preview.gallery') . $resultRow['path'] ?>" onclick="location.href='fullimg.php?sec=prof&ipath=<?= urlencode($resultRow['path']) ?>'">

        <div class="header">
          <?= htmlspecialchars(processText($resultRow['header'])) ?>
        </div>
        <div class="description">
          <?= htmlspecialchars(processText($resultRow['comment'])) ?>
        </div>

        <div class="info">
          <?= getMessageByKey("general.like") ?> <?= $resultRow['like'] ?><br>
          <?= getMessageByKey("general.dislike") ?> <?= $resultRow['dislike'] ?><br>
          <?= getMessageByKey("general.date") ?> <?= $resultRow['date'] ?><br>
          <?= getMessageByKey("general.time") ?> <?= $resultRow['time'] ?>
        </div>
        <?php
        if (!$guest) {

          ?>
          <div class="button" onclick="location.href='?action=profgaldel&galid=<?= $resultRow['id'] ?>'">
            <?= getMessageByKey('button.general.delete')?>
          </div>
        <?php
        }
        ?>
      </div>
    <?php
    } while ($resultRow = mysql_fetch_assoc($resultSet));
  }
  ?>




  <?php


  if (!$guest) {
  ?>

  <form enctype="multipart/form-data" accept-charset="UTF-8" action="?action=galimghand" method="post"
        id="galimgform">

    <div class="newcomment">
      <div class="info">
        <?= getMessageByKey("user.profile.gallery.new") ?>
      </div>
      <textarea name="header" id="imageheader" rows="1" placeholder="News header.." required="true"></textarea>
      <textarea name="legend" rows="11" placeholder="Type your legend here.."></textarea>
      <input type="hidden" name="MAX_FILE_SIZE" value="25000000"/>

      <input type="hidden" name="fid" value="<?= $_GET['fid'] ?>">
      <input type="hidden" name="reply" id="reply">

      <div class="buttonsdiv">


        <div class="fileselect">
          <input name="image" required="true" type="file" accept=".jpg, .png, .jpeg, .gif" id="realfileinput"
                 onmouseover="$('#fakefileinput').css('background-color', 'rgb(73, 67, 255)')"
                 onmouseout="$('#fakefileinput').css('background-color', 'rgba(0,0,0,1)')"
                 onclick="$('#galvisdiv').slideDown()"/>

          <div class="button" id="fakefileinput">
            <?= getMessageByKey("button.general.images") ?>
          </div>
        </div>


        <div class="button" onclick="customFormSubmit()">
          <?= getMessageByKey("button.general.add") ?>
        </div>
      </div>
    </div>
  </form>
</div>

  <!--        <div id="galvisdiv">-->
  <!--          --><? //= \controller\ControllerUtil::getMessageByKey("user.profile.gallery.visible") ?>
  <!--          <select class="updateuserinfoinput" name="galvis">-->
  <!--            <option selected value="true">-->
  <!--              --><? //= \controller\ControllerUtil::getMessageByKey("general.yes") ?>
  <!--            </option>-->
  <!--            <option value="false">-->
  <!--              --><? //= \controller\ControllerUtil::getMessageByKey("general.no") ?>
  <!--            </option>-->
  <!--          </select>-->
  <!--        </div>-->
<?php
}
?>